<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">子订单统计查询</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"
                                         />
                        <p:columnToggler datasource="CreditCompensatoryOrderDataTable" trigger="toggler"
                                         />
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"
                                         rendered="#{creditCompensatoryChildOrderStatListBean.isNormal() }"/>
                        <p:commandButton value="导出" icon="fa fa-download"
                                         rendered="#{creditCompensatoryChildOrderStatListBean.isNormal() }"
                                         ajax="false">
                            <p:dataExporter type="xls" target="CreditCompensatoryOrderDataTable" fileName="export"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">

                                <p:outputLabel for="orderid" value="订单号"/>
                                <p:inputText id="orderid" value="#{creditCompensatoryChildOrderStatListBean.$.childOrderNum}" style="width:100%"/>

                                <p:outputLabel for="entrance" value="入口"/>
                                <p:inputText id="entrance" value="#{creditCompensatoryChildOrderStatListBean.$.entrance}" style="width:100%"/>

                   				<p:outputLabel for="createStartDate" value="开始日期"/>
                                <p:calendar id="createStartDate" value="#{creditCompensatoryChildOrderStatListBean.$.startDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>

                                <p:outputLabel for="createEndDate" value="结束日期"/>
                                <p:calendar id="createEndDate" value="#{creditCompensatoryChildOrderStatListBean.$.endDate}"
                                            locale="#{constants:get('LOCALE')}"
                                            timeZone="#{constants:get('TIME_ZONE')}"
                                            pattern="#{constants:get('DATE_FORMAT')}"/>

                                <p:outputLabel for="prdId" value="产品"/>
                                <p:selectOneMenu id="prdId" value="#{creditCompensatoryChildOrderStatListBean.$.productname}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{creditCompensatoryChildOrderStatListBean.commProductIds}"
                                            var="product"
                                            itemLabel="#{product.name}" itemValue="#{product.productId}"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="remainamount" value="剩余额度"/>
                                <p:selectOneMenu id="remainamount" value="#{creditCompensatoryChildOrderStatListBean.$.remainamount}"
                                                 filter="true" filterMatchMode="contains">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemValue="0" itemLabel="低于310元或没有信用卡" noSelectionOption="true"/>
                                    <f:selectItem itemValue="1" itemLabel="310~500元" noSelectionOption="true"/>
                                    <f:selectItem itemValue="2" itemLabel="501~1000元" noSelectionOption="true"/>
                                    <f:selectItem itemValue="3" itemLabel="1001~1250元" noSelectionOption="true"/>
                                    <f:selectItem itemValue="4" itemLabel="高于1250元" noSelectionOption="true"/>

                                </p:selectOneMenu>

                                <p:outputLabel for="orderStatus" value="订单状态"/>
                                <p:selectOneMenu id="orderStatus" value="#{creditCompensatoryChildOrderStatListBean.$.status}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="初始化" itemValue="1" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="待确认" itemValue="10" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="处理中" itemValue="11" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="成功" itemValue="12" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="失败" itemValue="13" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="中止" itemValue="14" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="异常" itemValue="15" noSelectionOption="true"/>
                                </p:selectOneMenu>
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="CreditCompensatoryOrderDataTable"
                                         style="width: 100%"
                                         var="record"
                                         value="#{creditCompensatoryChildOrderStatListBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         selection="#{creditCompensatoryChildOrderStatListBean.selectedRecords}"
                                         resizableColumns="true"
                                         >

                                <p:column headerText="订单创建时间">
                                    <h:outputText value="#{record.createtime}">
                                        <f:convertDateTime pattern="#{constants:get('DATETIME_FORMAT')}"/>
                                    </h:outputText>
                                </p:column>

                                <p:column headerText="订单号">
                                    <h:outputText value="#{record.orderId}"/>
                                </p:column>

                                <p:column headerText="产品">
                                    <h:outputText value="#{creditCompensatoryChildOrderStatListBean.translateProduct(record.product)}"/>
                                </p:column>

                                <p:column headerText="渠道">
                                    <h:outputText value="#{creditCompensatoryChildOrderStatListBean.translateProductChannel(record.channel)}"/>
                                </p:column>

                                <p:column headerText="子订单数">
                                    <h:outputText value="#{record.childOrdernum}"/>
                                </p:column>
                                <p:column headerText="子订单总金额">
                                    <h:outputText value="#{record.childOrderPrice}"/>
                                </p:column>
                                <p:column headerText="剩余额度">
                                    <h:outputText value="#{record.remainamount}"/>
                                </p:column>
                                <p:column headerText="订单状态">
                                    <h:outputText value="#{creditCompensatoryChildOrderStatListBean.traslationOrderStatus(record.status)}"/>
                                </p:column>
                                <p:column headerText="入口">
                                    <h:outputText value="#{record.entrance}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
